import {Component} from 'react'
class Child extends Component{
  componentDidUpdate(){
    console.log('子组件的更新componentDidUpdate');
  }
  render(){
    console.log('子组件的render');
    return(
      <div>
        <h1>测试子组件的生命周期函数</h1>
      </div>
    )
  }
}
class Header extends Component{
 state = {
  count:0
}
updateCount = () =>{
  this.setState({
    count:this.state.count+1
  })
}
  componentDidUpdate(){
    console.log('父组件的更新结束componentDidUpdate');
  }
  render(){
    console.log('父组件的更新render');
    return(
      <div>
        <h1>测试类组件的生命周期函数</h1>
        <Child />
        <button onClick={this.updateCount}>修改count</button>
      </div>
    )
  }
}
function App(){
  return(
    <div>
      <Header/>
    </div>
  )
}
export default App